home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr23 / csmac13a.zip / JB-LEARN.MAC < prev    next >
Text File  |  1995-01-22  |  42KB  |  1,153 lines

  1.                                  JB-LEARN
  2.                                Version 1.1
  3.                          for {COMMO} Version 6.4X
  4.                       Copyright (C) 1995, Jeff Bishop
  5.                              January 22, 1995
  6.  
  7. Introduction
  8.  
  9.      I have always loved writing {COMMO} macros.  My first major
  10.      macro project (JBHOST) was just the beginning.  I wrote that
  11.      and have used it ever since for all kinds of activities.
  12.      After examining other telecommunication programs to see what
  13.      could be added to {COMMO} I came up with the idea of writing
  14.      a automatic learn macro for {COMMO}.
  15.  
  16.      The {COMMO} macro language is very complex.  Many users have
  17.      been scared of it due to this fact.  I thought to myself
  18.      "what could I do to make it easier".  I decided to write a
  19.      macro that would create {COMMO} macros for login activities
  20.      (or any activity the user wishes).  After weeks of work, JB
  21.      Learn was born to satisfy this requirement/need.
  22.  
  23. What Can JB-Learn do?
  24.  
  25.      JB-Learn has the following features:
  26.  
  27.      -    A very solid learn engine to create ready-to-run macros
  28.           after learn mode is complete.
  29.  
  30.      -    A learn data file capacity to make future learning more
  31.           intelligent.  The learn macro learns as you use it.  This
  32.           is a first in the BBS community.  Find another learn
  33.           engine that can do that (except CS-LEARN for {COMMO}).
  34.           The user has complete control as to what it learns.
  35.  
  36.      -    The learn data file will process {COMMO} variables for
  37.           you.  This gives you even more power.  This allows for great
  38.           flexibility when using CS-MAC since it defines a wealth of
  39.           variables that you can use.
  40.  
  41.      -    Have complete control of your learning experience.  You
  42.           make the decisions if you want to.  This provides the
  43.           ability to correct mistakes that the learn can not
  44.           handle.  This provides the ability to create very solid
  45.           macros.  Just think, you tell the teacher what to do and get a
  46.           better grade for it.
  47.  
  48.      -    Automatic detection of front end mailers.  No need to
  49.           press <ESCAPE> twice any more (even during learning) as long as
  50.           EMSI protocol is being used.
  51.  
  52.      -    The learn can automatically try to log you in without
  53.           user intervention.  This is similar to most other
  54.           conventional learn engines available in other
  55.           communication programs.
  56.  
  57.      -    The ability to add SSLOOK logic in your macros. This will make them
  58.           more stream lined for those nagging prompts often seen on BBS's.
  59.  
  60.      -    The macro is FREE for your use.  The source code is very
  61.           well commented for a great learning experience.
  62.  
  63. Contact Information
  64.  
  65.      I value all of your input.  Please contact me with any
  66.      suggestions you may have.  You can contact me via the following methods:
  67.  
  68.      Jeff Bishop
  69.      Mailing Address: 420 E Yavapai RD. NO. H Tucson, AZ 85705
  70.      E-Mail Address : JBISHOP@PRIMENET.COM
  71.      Voice Phone    : 1-602-888-1456 (evenings before 12:00AM EST).
  72.  
  73.      I can also be reached in the COMMO conference in the fidonet
  74.      and WME message networks.  Post a message to "jeff bishop" and I will
  75.      surely respond to it.
  76.  
  77. Getting JB-Learn Updates
  78.  
  79.      JB-Learn is distributed in two different packages.  I am distributing it
  80.      as a stand alone package and it is also in the CS-MAC package (version 13
  81.      and above).  If you are reading this from the CS-MAC archive, this may or
  82.      may not be the latest one.  Use the information below to get the latest
  83.      and greatest version.
  84.  
  85.      If you have access to the internet, you can use ftp to get JB
  86.      Learn. Ftp to ftp.primenet.com.  Login as anonymous and send
  87.      your e-mail address as the password.  Once logged in, cd to
  88.      /users/j/jbishop/commo.  Once here, get the file jbl-*.zip.  This
  89.      will get you the latest version. You are also welcome to get the latest
  90.      version of CS-MAC here as well. Get the file cs*.zip.
  91.  
  92.      If you wish, you can also ftp to ftp.nlbbs.com. Login as anonymous and
  93.      send your mail address as password. Once here, cd to /pub/cs-mac.
  94.  
  95.      If you do not have access to the internet, you can log in to
  96.      the Demodulator BBS.  The phone number is 1-602-290-2807.  Use
  97.      'COMMO RELEASE' as your first and last name.  Use 'guest' as the
  98.      password.  A menu will be presented to allow you to pick JB-Learn from.
  99.      In addition, other {COMMO} products can be downloaded from this menu. 
  100.  
  101. ===========================================
  102.  
  103. {:JB-LEARN}
  104.      This is the beginning of the macro.  Here is where basic
  105.      setup is done to prepare for learn operation.
  106.  
  107.      {NOCARRIER QUIT}
  108.      Quit learn if carrier is lost.
  109.  
  110.      {SETVARIABLE JBL_VER,1.1}
  111.      Set the version number here.
  112.  
  113.      {SETESCAPE-P0 ENT_LRN}
  114.      Define the label to go to when the <ESCAPE> key is pressed at the local
  115.      keyboard.
  116.  
  117.      {SETGET ,,L}
  118.      Make all keyboard input echo to the local terminal only.
  119.  
  120.      {SETVARIABLE AUTORESP,N}
  121.      This variable tells JB-LEARN whether or not to ask for confirmation of
  122.      each response found while reading the LEARN.DAT data file.
  123.      If it is set to 'Y', the macro will act in a true auto-learn mode.
  124.  
  125.      {SETVARIABLE DATAFILE,%_HOM%learn.dat}
  126.      This defines the INI filename used.  The default is %_HOM%LEARN.DAT.
  127.  
  128.      {SETVARIABLE ESCAPE_2,~^[~^[}
  129.      Define a variable as 2 escapes.
  130.  
  131.      {SETVARIABLE CAPTFILE,%_HOM^(JBLRN^).CAP}
  132.      We are defining the name of the temporary capture file used
  133.      throughout this macro.
  134.  
  135.      {SETVARIABLE FON_FILE,%_HOM^(JBLRN^).FON}
  136.      We are defining the name of the temporary FON file used
  137.      throughout this macro.
  138.  
  139.      {SETVARIABLE NOV_MENU,Y}
  140.      Set JB-Learn menu in novice mode.
  141.  
  142.      {SETVARIABLE SSLK_CNT,0}
  143.      Set the SSLOOK counter to 0.
  144.  
  145.      {SETVARIABLE SSLKAUTO,N}
  146.      Set this variable to Y if you want SSLOOKS to be automatically generated
  147.      instead of LOOKFOR/SEND pairs.  This is only going to happen in the area
  148.      that the data file is processed.  It will not affect the JB-Learn menu.
  149.  
  150.      {SETVARIABLE WAITTIME,15}
  151.      This variable defines the length of time after all modem
  152.      activity stops before the learn process starts interacting
  153.      with the user.  The default is 15 seconds.  Change the
  154.      definition if you would like.  Be careful though to keep it
  155.      long enough.  Making it too short will have disastrous
  156.      affects in the learn engine.  If this variable is set as NULL,
  157.      then this auto learn type feature is turned off.
  158.  
  159.      {CALL OPEN_CAP}
  160.      Open the capture file.
  161.  
  162. {:LEARNING}
  163.      This label begins the learning online process.
  164.  
  165.      We are now going to define the learn robot.
  166.  
  167.      {SETLOOK %WAITTIME}
  168.      This defines the setlook timer.
  169.  
  170.      {GOLOOK LEARNING,^M}
  171.      The look timer is continuously reset upon seeing a <ENTER>
  172.      character.  When it is seen, the macro jumps back to the
  173.      LEARNING label.
  174.  
  175.      {SSLOOK ESCAPE_2,**EMSI_}
  176.      Watch for the EMSI protocol string. When it comes in, send two escapes.
  177.  
  178.      {LOOKFOR <ESC> FOR LEARN MODE}
  179.      Show a dummy lookfor and provide information to the user on
  180.      the status line.
  181.  
  182. {:ENT_LRN}
  183.      Start parsing the BBS prompt now.
  184.  
  185.      {CAPTURE N}{WOPEN-A %CAPTFILE}{WRITE}{WCLOSE}
  186.      Turn off the capture file.  Open the capture file to write to (in append
  187.      mode).  Write a blank line to the file to insure that the capture file
  188.      ends with a CR/LF pair.  Close the capture file.
  189.  
  190.      {ROPEN %CAPTFILE,ERD}
  191.      Open the capture file for reading.  Once the capture file has
  192.      been read completely, go to the label ERD.
  193.  
  194.      {SETVARIABLE T}{SETVARIABLE LOOK_FOR}
  195.      Clear the variables used during the read loop below.
  196.  
  197. {:RDL}
  198.      Enter the capture file read loop to find the BBS prompt.
  199.  
  200.      {READ T}{COMPARE T}{IFCONDITION RDL}
  201.      Read a line from the file.  If the line is blank, go get another one.
  202.  
  203.      {SETVARIABLE LOOK_FOR,%T}{GOTO RDL}
  204.      Set the LOOK_FOR variable to the line read and go get another line from
  205.      the file.
  206.  
  207. {:ERD}
  208.      End of file read label definition.
  209.  
  210.      {COMPARE LOOK_FOR}{IFCONDITION ,JBLRNDAT}
  211.      We are checking to see if we have found a BBS prompt.  If we
  212.      have, then control passes to parse the data file.  Otherwise,
  213.      we will now ask the user to supply a look_for string (BBS prompt).
  214.  
  215.      {CLEAR}{DISPLAY 1,1,,ENTER THE STRING TO LOOK FOR (BBS PROMPT): }
  216.      {GETSTRING-I LOOK_FOR,32}
  217.      Clear the screen and ask the user to supply a BBS prompt.
  218.  
  219.      {COMPARE LOOK_FOR}{IFCONDITION QUIT}
  220.      See if the user entered a BBS prompt.  If they did not, leave
  221.      the learn macro.
  222.  
  223. {:JBLRNDAT}
  224.      This is the label used to designate processing of the data file.
  225.  
  226.      {SUBSTRING LOOK_FOR,-32,32,%LOOK_FOR}
  227.      Grab the last 32 characters of the BBS prompt as the target string.
  228.  
  229.      {COMPARE LRN_MAC}{IFCONDITION ,LOAD_DAT}
  230.      If the macro file has already been defined process the data file.
  231.  
  232.      We are now beginning to define the name of the macro file to
  233.      write to during learn operation.
  234.  
  235.      {SETVARIABLE LRN_MAC,%_MAC}
  236.      We will first set the name of the macro file to the current
  237.      {COMMO} macro file name.  The user may change it later.
  238.  
  239. {:DEF_MAC}
  240.      The macro entry loop.
  241.  
  242.      {KEYSTUFF 4700}
  243.      Stuff a HOME key into the keyboard buffer.  This will force
  244.      the cursor at the beginning of the line of the input window.
  245.  
  246.      {INPUT LRN_MAC,ENTER MACRO FILE TO APPEND TO}
  247.      Allow the user to edit the macro name if need be.
  248.  
  249.      {COMPARE LRN_MAC}{IFCONDITION DEF_MAC}
  250.      Check and see if the macro is NULL.  If it is, go back and
  251.      re-enter it.
  252.  
  253.      We are now going to define the label to be used for this
  254.      learned macro entry.
  255.  
  256.      This is the start of a routine to remove invalid characters
  257.      from the label name.  The characters we will remove are the
  258.      comma, space, colon, slash, and curly braces
  259.  
  260.      {SETVARIABLE INVALID,, :/^(^)}
  261.      This sets the invalid characters that will be stripped from
  262.      the system name to make the label name.
  263.  
  264.      {SETVARIABLE COUNT,0}
  265.      Initialize a counter that will be used to step through the
  266.      system name character by character.
  267.  
  268.      {SETVARIABLE LRN_LBL}
  269.      Initialize the macro label
  270.  
  271. {:XLATE_LOOP}
  272.      This is the loop that checks each character and removes
  273.      invalid characters.
  274.  
  275.      {INCREMENT COUNT}
  276.      Increment the placekeeper that checks each character in the
  277.      system name.
  278.  
  279.      {SUBSTRING CH,%COUNT,1,%_NAM}
  280.      This takes a character out of the system name (%_NAM) and
  281.      puts it in variable %CH
  282.  
  283.      {COMPARE CH}
  284.      This is checking for the end of the system name.  If we have
  285.      reached the end, the variable %CH will be empty.
  286.  
  287.      {IFCONDITION XLATE_DONE}
  288.      If the variable %CH was empty, we are done.  Otherwise,
  289.      continue to see if this is an invalid character.
  290.  
  291.      {INSTRING INVALID,%CH}
  292.      Check to see if this character is in the invalid list.
  293.  
  294.      {IFCONDITION XLATE_LOOP}
  295.      If it is in the invalid list, loop back.
  296.      If this character is not on the invalid list, it will be added
  297.      to the label.
  298.  
  299.      {SETVARIABLE LRN_LBL,%LRN_LBL%%CH}
  300.      The act of sticking two variables back-to-back like this is
  301.      called "concatenating".  Variable %LRN_LBL will keep growing until
  302.      the end of the system name is reached.
  303.  
  304.      {LENGTH %LRN_LBL}
  305.      This gets the length of the %LRN_LBL string and puts it into %_LEN
  306.  
  307.      {COMPARE _LEN,10}
  308.      The length of the %LRN_LBL string is compared with the value "10".
  309.  
  310.      {IFCONDITION-E ,XLATE_LOOP}
  311.      If the length of the label equals 10, the routine will go to
  312.      the next step.  If %_LEN does not equal 10, the routine will
  313.      return to the top of the loop to get the next character.
  314.  
  315. {:XLATE_DONE}
  316.      Finish processing label definition.
  317.  
  318.      {SETVARIABLE COUNT}{KEYSTUFF 4700}
  319.      Stuff a HOME key into the keyboard buffer.  This will force
  320.      the cursor at the beginning of the line of the input window.
  321.  
  322.      {INPUT LRN_LBL,ENTER LABEL NAME USED FOR THIS MACRO}
  323.      Allow the user to edit the label name.
  324.  
  325.      {COMPARE LRN_LBL}{IFCONDITION XLATE_DONE}
  326.      Check and see if the label is NULL.  If it is, go back and
  327.      re-enter it.
  328.  
  329.      {WOPEN-A %LRN_MAC}{WRITE}
  330.      Open the macro file and write a blank line to it.
  331.  
  332.      {WRITE ^(:%LRN_LBL^)}
  333.      Write the label in the macro file now.
  334.  
  335.      {WRITE ^(SETVARIABLE ESCAPE_2,~^[~^[^)}
  336.      Write a variable definition to the macro as 2 escapes.
  337.  
  338.      {WRITE ^(SSLOOK ESCAPE_2,**EMSI_^)}{WRITE}{WCLOSE}
  339.      Some BBS programs use a front end mailer.  These front end
  340.      mailers ask the user to press <ESCAPE> twice to enter the
  341.      BBS.  This line automatically senses these front end mailers
  342.      and will send the <ESCAPE> characters for you.  After writing is
  343.      done, close the file.
  344.  
  345.      {CLEAR}{DISPLAY 1,1,,DO YOU WANT TO USE AUTO-LEARN MODE (Y/N) [N]? }
  346.      {GETSTRING-HI AUTORESP,1}{CLEAR}
  347.      Clear the screen.  Ask the user if they want to use auto-learn mode.
  348.      The only way this feature is turned on is if AUTORESP is set to 'Y'.
  349.  
  350. {:LOAD_DAT}
  351.      Check and see if the BBS prompt has already been seen. If so, generate
  352.      the response automatically. Otherwise, begin loading the data file.
  353.  
  354.      {SETVARIABLE COUNT,0}
  355.      Initialize the counter to 0
  356.  
  357. {:CHK_SLOP}
  358.  
  359.      {INCREMENT COUNT}{SETVARIABLE-S T,SLR_%COUNT}
  360.      Increment the counter and get the response string for the SSLOOK.
  361.  
  362.      {COMPARE T}{IFCONDITION LOADDAT1}{SETVARIABLE RESP,%T}{SETVARIABLE T}
  363.      See if no response is available. If there is not one, end this routine.
  364.  
  365.      {SETVARIABLE-S T,SLT_%COUNT}
  366.      Assign the target to the temporary variable.
  367.  
  368.      {INSTRING T,%LOOK_FOR}{IFCONDITION ,CHK_SLOP}
  369.      Check and see if this target matches the BBS prompt found. If it does,
  370.      process it. If it is not, go get another SSLOOK variable.
  371.  
  372.      {WOPEN-A %LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%LOOK_FOR^)}{WRITE}{WCLOSE}
  373.      {INFORM-D1 AUTOMATIC RESPONSE BEING GENERATED ...}{SEND %RESP}
  374.      {GOTO CLN_QUIT}
  375.  
  376. {:LOADDAT1}
  377.  
  378.      {SETVARIABLE COUNT}{SETVARIABLE RESP}{SETVARIABLE T}
  379.      {IFEXIST %DATAFILE,OPENDATA}
  380.      If the data file does exist, process it. If it does not, ask the user
  381.      to supply the name of the data file.
  382.  
  383.      {KEYSTUFF 4700}
  384.      Stuff a HOME key into the keyboard buffer.  This will force
  385.      the cursor at the beginning of the line of the input window.
  386.  
  387.      {INPUT DATAFILE,ENTER NAME OF LEARN DATA FILE (LEAVE BLANK TO IGNORE IT):}
  388.      Ask the user for the name of the data file.
  389.  
  390.      {COMPARE DATAFILE}{IFCONDITION MENU}
  391.      {IFEXIST %DATAFILE,,LOAD_DAT}
  392.      See if the variable is blank. If it is, jump to the learn menu. If it
  393.      is not, process the newly entered value again.
  394.  
  395. {:OPENDATA}
  396.      This is where the data file is opened.
  397.  
  398.      {ROPEN %DATAFILE,DATA_EOF}
  399.      Open the INI file for reading.
  400.  
  401. {:DAT_LOOP}
  402.      Here is where the INI file loop begins.
  403.  
  404.      {SETVARIABLE POS}{SETVARIABLE T}
  405.      {SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
  406.      Clear all variables used in the loop.
  407.  
  408.      {READ T}
  409.      Read a line from the DAT file.
  410.  
  411.      {COMPARE T}{IFCONDITION DAT_LOOP}
  412.      {SUBSTRING POS,1,1,%T}{COMPARE POS, }{IFCONDITION DAT_LOOP}
  413.      Check to see if the line read is blank.  If it is, go get
  414.      another.  Check and see if the first character in the line is a space.
  415.      If it is, get another line.
  416.  
  417.      {INSTRING T,,}
  418.      {IFCONDITION ,DAT_LOOP}
  419.      Check and see if the line read as a target/response match.
  420.      If it is not, go get another.
  421.  
  422.      {SETVARIABLE POS,%_POS}
  423.      Set the position found to POS.
  424.  
  425.      {INCREMENT POS,1}
  426.      Increment the position variable by 1.
  427.  
  428.      {SUBSTRING TARGET,%POS,255,%T}
  429.      Get the target string from the line read from the INI file.
  430.  
  431.      {COMPARE TARGET}{IFCONDITION DAT_LOOP}
  432.      Check and see if the target is blank.  If it is, get another
  433.      line from the INI file.
  434.  
  435.      {INSTRING LOOK_FOR,%TARGET}
  436.      Look to see if this defined target exists in the BBS prompt
  437.      defined earlier.
  438.  
  439.      {IFCONDITION ,DAT_LOOP}
  440.      Check and see if this target matches anything in the BBS
  441.      prompt.  If it does not, processing returns for another line
  442.      out of the INI file.
  443.  
  444.      {DECREMENT POS,2}
  445.      Decrement the position variable defined earlier by 2.
  446.  
  447.      {SUBSTRING RESPONSE,1,%POS,%T}
  448.      Get the response string from the data out of the INI file.
  449.  
  450.      {COMPARE RESPONSE}{IFCONDITION DAT_LOOP}{RCLOSE}
  451.      Close the INI file.
  452.  
  453. {:DATA_EOF}
  454.      This label is the label used after the INI file is closed.
  455.  
  456.      {COMPARE RESPONSE}{IFCONDITION MENU}
  457.      See if the response is blank.  If it is, jump to the learn menu.
  458.  
  459.      {SUBSTRING T,1,1,%RESPONSE}
  460.      Look at the first character of the response.
  461.  
  462.      {COMPARE T,%%}
  463.      Is the first character of the response a "%"?
  464.      Notice using two %'s in order to represent a literal "%"
  465.  
  466.      {IFCONDITION ,CONFGUES}
  467.      If the first character of the RESPONSE indicates that it is a
  468.      Commo variable, we will proceed to translate the variable into
  469.      it's literal expression.  For example, %NAME will be converted
  470.      to "Jeff Bishop".
  471.  
  472.      If the first character of the RESPONSE isn't a "%", jump to
  473.      the menu that asks you to confirm the response before sending it.
  474.      That menu is located at label :CONFGUES
  475.  
  476.      {SUBSTRING RESPONSE,2,200,%RESPONSE}
  477.      The first step in the translation is to strip off the leading
  478.      "%" character.  Notice that this command substrings a variable
  479.      back into itself.
  480.  
  481.      {INSTRING RESPONSE,|}
  482.      The next step is to check the response variable for presence
  483.      of a "pipe" character.  The macro assumes that the pipe would
  484.      only appear as the last character of a response.
  485.  
  486.      {IFCONDITION-C STRIP-PIPE}
  487.      If the response variable has a pipe character in it, we are
  488.      going to call a routine to strip it off.  Otherwise, we will
  489.      continue on our translation journey directly.  To make the
  490.      IFCONDITION function perform a "call", the "-C" switch is
  491.      used.  If we strip off the "pipe", we will add it back on
  492.      after performing the translation step.
  493.  
  494.      {SETVARIABLE-S T,%RESPONSE}
  495.      This single step translates the variable name into the
  496.      contents of the variable name.  Fred Brucker's explanation
  497.      in MACRO.DOC is very good (hint to read the docs).
  498.  
  499.      Basically, this is a two step setvariable function.  Step one
  500.      expands the %response to make this example command
  501.      Step 1   (setvariable t,%name)       ;%t=name
  502.      Step 2   performs the above command  ;%t=Jeff Bishop
  503.  
  504.      {COMPARE T}
  505.      Now checking if you have %name (for example) defined.  If
  506.      you haven't defined a variable in Commospace, %T will now
  507.      be NUL.  This would be a disaster to the continuation
  508.      of the learn macro.
  509.  
  510.      {IFCONDITION-C N_VARDEF}
  511.      If the response is NUL, we are going to call a routine to ask
  512.      you to define it.  Otherwise, we will proceed with the
  513.      translation.
  514.  
  515.      {SETVARIABLE RESPONSE,%T}
  516.      This command moves the contents of %T into %RESPONSE, and we are
  517.      assured that %T is not NUL ... therefore %RESPONSE is not NUL.
  518.  
  519.      {COMPARE STRIPT}
  520.      Now checking if we earlier made a trip to the routine that
  521.      strips off a trailing "pipe" character.  If %stript is NUL,
  522.      it means we didn't make the trip to :STRIP-PIPE
  523.  
  524.      {IFCONDITION CONFGUES}
  525.      If %stript is NUL, meaning we didn't strip off a trailing
  526.      "pipe", then jump to the routine that asks you to confirm the
  527.      response before it is sent.  Translation is complete.
  528.  
  529.      If %stript contains a value, it means that we DID make a trip
  530.      to the :STRIP-PIPE routine.  If that is the case, our
  531.      translation isn't complete yet, we have to add the "pipe"
  532.      back onto the response.
  533.  
  534.      {SETVARIABLE RESPONSE,%RESPONSE|}
  535.      This simply puts the "pipe" character back on the translated
  536.      variable (turning %name| into Jeff Bishop|).
  537.  
  538.      {SETVARIABLE STRIPT}
  539.      This clears the variable that was used to indicate that we had
  540.      made a call to :STRIP-PIPE
  541.  
  542.      {GOTO CONFGUES}
  543.      Translation is complete.  Go to the routine that asks you to
  544.      confirm the response before it is sent.
  545.  
  546. {:STRIP-PIPE}
  547.      This label is the start of a routine to remove a trailing "|"
  548.      from a variable.  The command that happened just before coming
  549.      here was (instring response,|).  We are here because the
  550.      answer to that was "YES", there IS a "pipe" in %RESPONSE.
  551.  
  552.      {SETVARIABLE LEN,%_POS}
  553.      This puts the position of the "|" (given by the instring
  554.      function as %_pos) into %len.  Commo does not provide for
  555.      tampering with the %_pos variable.
  556.  
  557.      {DECREMENT LEN,1}
  558.      {SUBSTRING RESPONSE,1,%LEN,%RESPONSE}
  559.      These two commands strip the last character from the
  560.      %RESPONSE variable, in this case we have stripped a "|".
  561.  
  562.      {SETVARIABLE STRIPT,Y}
  563.      This sets a variable that we will later use to replace the
  564.      character that we stripped off with this routine.
  565.  
  566.      {RETURN}
  567.      This is the end of the :STRIP-PIPE subroutine.  Return to
  568.      the place called from.
  569.  
  570. {:N_VARDEF}
  571.      This label is the start of a routine that prompts you for a
  572.      setting for a variable.  This routine is called when a
  573.      variable appears in the LEARN.DAT file and that variable
  574.      isn't found in the currently defined Commo variables.
  575.      Typically, these variables would be %name and %_pas.
  576.  
  577.      {CLEAR}
  578.      {DISPLAY 1,1,,Input a value for %%%response: }
  579.      The first two % signs cause a % to be displayed.  The third
  580.      one causes %response to be displayed as its value.
  581.      An example result .... "Input a value for %name: "
  582.  
  583.      {GETSTRING-I %%RESPONSE}
  584.      This simple looking command is a very powerful command.
  585.      Notice that there are two % signs.  This means, in this
  586.      example, that we are getting a value for %name.  The "-I"
  587.      switch restricts input to the keyboard, if the host system
  588.      sends anything, it will be ignored.
  589.  
  590.      {COMPARE %%RESPONSE}
  591.      Checking to make sure that you have put a value in for this
  592.      variable.  Have you a value for %name?
  593.  
  594.      {IFCONDITION N_VARDEF}
  595.      If %%response (in example, %name) is NUL, repeat the routine
  596.      until you put in a value.
  597.  
  598.      {SETVARIABLE-S T,%RESPONSE}
  599.      This is similar to the command that was used in the primary
  600.      translation routine.  By example, it first "expands" %response
  601.      to %name, then it sets %T=contents of %name.
  602.      {RETURN}
  603.      This is the end of the routine that asks you to define a variable.
  604.  
  605.      This label marks the end of reading the INI file and making any necessary
  606.      variable translations.
  607.  
  608. {:CONFGUES}
  609.      This is the start of a menu that asks you to confirm your response to
  610.      this BBS prompt.
  611.  
  612.      {COMPARE AUTORESP,Y}{IFCONDITION RITERESP}
  613.      See if the user does not want to get prompted.
  614.  
  615.      {CLEAR}
  616.      {DISPLAY 1,1,,BBS PROMPT: %LOOK_FOR}
  617.      Clear the screen and show the BBS prompt.
  618.  
  619.      {COMPARE RESPONSE,%_PAS|}{IFCONDITION ,C_GUESS1}
  620.      {DISPLAY 2,1,,RESPONSE STRING : ^(PASSWORD^)}{GOTO GUESSCHK}
  621. {:C_GUESS1}
  622.      {DISPLAY 2,1,,RESPONSE STRING : %RESPONSE}
  623. {:GUESSCHK}
  624.      {DISPLAY 4,1,,IS THIS RESPONSE CORRECT (Y/N) [N]? }
  625.      Display the response and target strings and ask if the
  626.      response is correct.
  627.  
  628.      {GETSTRING-HI KEY,1,MENU}
  629.      Get keyboard input.  If the user presses <ENTER> controls passes to the
  630.      learn menu.
  631.  
  632.      {COMPARE KEY,Y}{IFCONDITION ,MENU}
  633.      If the user presses N control will pass to the learn menu.
  634.  
  635.      {COMPARE SSLK_CNT,15}{IFCONDITION-L ,RITERESP}
  636.      {COMPARE SSLKAUTO,Y}{IFCONDITION RITESSLK}
  637.      See if the SSLOOK count is less than 15. If it is, continue. If it is
  638.      not, bypass SSLOOK logic.
  639.  
  640.      {CLEAR}
  641.      {DISPLAY 1,1,,DEFINE THIS AS A SSLOOK STRING COMBINATION (Y/N) [N]? }
  642.      {GETSTRING-HI KEY,1,RITERESP}
  643.      Get keyboard input.  If the user presses <ENTER> controls passes to the
  644.      normal LOOKFOR/SEND macro method.
  645.  
  646.      {COMPARE KEY,Y}{IFCONDITION ,RITERESP}
  647.      If the user presses N control will pass to the LOOKFOR/SEND macro logic.
  648.  
  649. {:RITESSLK}
  650.  
  651.      {INCREMENT SSLK_CNT}
  652.      Increment the SSLOOK counter.
  653.  
  654.      {SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
  655.      {SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
  656.      Build the SSLOOK strings.
  657.  
  658.      {WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
  659.      {WRITE ^(SSLOOK SLR_%SSLK_CNT,%LOOK_FOR^)}{WRITE}{WCLOSE}{GOTO RITEDONE}
  660.      Write the variable definition and the SSLOOK to the macro file. Continue
  661.      macro execution.
  662.  
  663. {:RITERESP}
  664.      {WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}
  665.      {WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}{SETVARIABLE SSLK_CNT,0}
  666.      Open the macro file.  Write the commands to it.  After doing
  667.      so, close the macro file. Reset the SSLOOK counter to 0.
  668.  
  669. {:RITEDONE}
  670.  
  671.      {COMPARE T,%%_PAS}{IFCONDITION ,GUES_END}
  672.      {PASSWORD}{SEND |}{GOTO CLN_QUIT}
  673.  
  674. {:GUES_END}
  675.  
  676.      {SEND %RESPONSE}{GOTO CLN_QUIT}
  677.      Send the response string now.  Clean up now.
  678.  
  679. {:MENU}
  680.      This label begins the learn menu.
  681.  
  682.      {CLEAR}
  683.      {COMPARE NOV_MENU,Y}{IFCONDITION ,MENU1}
  684.      {DISPLAY 1,1,,JB-LEARN RESPONSE TYPE MENU - VERSION %JBL_VER}
  685.      {DISPLAY 2,1,,BBS PROMPT: %LOOK_FOR}
  686.      {DISPLAY 4,1,,C - CONTINUE LEARNING}
  687.      {DISPLAY 6,1,,E - SEND <ENTER>}
  688.      {DISPLAY 8,1,,F - BYPASS FRONT END BBS MAILER WITH TWO <ESCAPES>}
  689.      {DISPLAY 10,1,,H - TREAT AS A SINGLE KEY HOT KEY (NO <CR>)}
  690.      {DISPLAY 12,1,,I - INSERT COMMENT INTO MACRO}
  691.      {DISPLAY 13,1,,L - TREAT AS A SSLOOK STRING: (SSLOOK COUNT %SSLK_CNT)}
  692.      {DISPLAY 15,1,,P - TREAT AS A PASSWORD}
  693.      {DISPLAY 16,1,,Q - QUIT JB-LEARN}
  694.      {DISPLAY 18,1,,R - REVISE/EDIT BBS PROMPT}
  695.      {DISPLAY 20,1,,S - ENTER STANDARD BBS RESPONSE (WITH <CR>)}
  696.      {DISPLAY 22,1,,W - SET WAIT TIME: %WAITTIME}
  697.      {DISPLAY 23,1,,X - TOGGLE BETWEEN NOVICE AND EXPERT MENU}
  698.      {DISPLAY 24,1,,ENTER CHOICE: C,E,F,H,I,L,P,Q,R,S,W,X: }
  699.      Clear the screen and display the menu.
  700.      {GOTO MENU2}
  701. {:MENU1}
  702.      {DISPLAY 1,1,,ENTER CHOICE: C,E,F,H,I,L,P,Q,R,S,W,X: }
  703.  
  704. {:MENU2}
  705.      {GETSTRING-HI KEY,1,MENU}
  706.      Prompt for keyboard input.  If <ENTER> is pressed by itself,
  707.      control passes to the label shown at the end of the line.
  708.  
  709.      {COMPARE KEY,C}{IFCONDITION CLN_QUIT}
  710.      {COMPARE KEY,E}{IFCONDITION JBL_SNCR}
  711.      {COMPARE KEY,F}{IFCONDITION FRONTEND}
  712.      {COMPARE KEY,H}{IFCONDITION JBL_HKEY}
  713.      {COMPARE KEY,I}{IFCONDITION INS_CMNT}
  714.      {COMPARE SSLK_CNT,15}{IFCONDITION-L ,MENU3}
  715.      {COMPARE KEY,L}{IFCONDITION D_SSLOOK}
  716. {:MENU3}
  717.      {COMPARE KEY,P}{IFCONDITION JBL_PASS}
  718.      {COMPARE KEY,Q}{IFCONDITION QUIT}
  719.      {COMPARE KEY,R}{IFCONDITION EDITBPMT}
  720.      {COMPARE KEY,S}{IFCONDITION JBL_STD}
  721.      {COMPARE KEY,W}{IFCONDITION WAITTIME}
  722.      {COMPARE KEY,X}{IFCONDITION ,MENU}
  723.      {COMPARE NOV_MENU,Y}{IFCONDITION MENU4}
  724.      {SETVARIABLE NOV_MENU,Y}{GOTO MENU}
  725. {:MENU4}
  726.      {SETVARIABLE NOV_MENU,N}
  727.  
  728.      Check for each option on the menu to see if the user
  729.      selected it and branch accordingly.
  730.  
  731.      {GOTO MENU}
  732.      None of the options matched the key pressed, re-display the
  733.      menu.
  734.  
  735. {:JBL_SNCR}
  736.      Send <ENTER> label.
  737.  
  738.      {WOPEN-A %LRN_MAC}
  739.      {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND |^)}{WRITE}{WCLOSE}
  740.      {SETVARIABLE SSLK_CNT,0}
  741.      Open the macro file.  Write the command to look for the BBS
  742.      prompt followed by a command to send the <ENTER> key.  The
  743.      file is then closed.
  744.  
  745.      {SEND |}{SETVARIABLE RESPONSE,|}{GOTO CLEAN_UP}
  746.      Send the <ENTER> out to the BBS now and clean up after that.
  747.  
  748. {:FRONTEND}
  749.      Send escape characters to bypass front end mailers.
  750.  
  751.      {SEND %ESCAPE_2}{GOTO CLN_QUIT}
  752.  
  753. {:JBL_HKEY}
  754.      Process hot key entries.
  755.  
  756.      {CLEAR}
  757.      Clear the screen.
  758.  
  759.      {DISPLAY 1,1,,ENTER THE KEY TO SEND TO THE HOST: }
  760.      Prompt the user for a key.
  761.  
  762.      {GETSTRING-HI KEY,1,MENU}
  763.      Get keyboard input.  If the user presses <ENTER>, then
  764.      control passes back to the main learn menu.
  765.  
  766.      {WOPEN-A %LRN_MAC}
  767.      {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %KEY^)}{WRITE}{WCLOSE}
  768.      Open the macro file and write the two commands to the file.
  769.      Close the file.
  770.  
  771.      {SETVARIABLE SSLK_CNT,0}{SEND %KEY}{SETVARIABLE RESPONSE,%KEY}
  772.      {GOTO CLEAN_UP}
  773.      Send the key to the BBS and clean up after it.
  774.  
  775. {:INS_CMNT}
  776.      Insert comment into macro file.
  777.  
  778.      {INPUT T,ENTER A COMMENT TO PLACE INTO THE MACRO FILE: }
  779.      Prompt the user for a comment.
  780.  
  781.      {WOPEN-A %LRN_MAC}{WRITE}{WRITE %T}{WRITE}{WCLOSE}
  782.      Open the macro file and write the comment to the file.
  783.      Close the file.
  784.  
  785.      {SETVARIABLE T}{GOTO CLN_QUIT}
  786.  
  787. {:D_SSLOOK}
  788.      Define a SSLOOK definition for the macro.
  789.  
  790.      {SETVARIABLE RESPONSE}
  791.      Clear out the variable that is going to be used.
  792.  
  793.      {INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
  794.      Ask the user to enter a string.
  795.  
  796.      {CLEAR}
  797.      {DISPLAY 1,1,,DO YOU WANT A <CR> SENT WITH THIS STRING (Y/N) [N]? }
  798.      {GETSTRING-HI CH,1,SSLKCONT}
  799.      Ask the user if he/she would like to have a <CR> attached to the entered
  800.      string.
  801.  
  802.      {COMPARE CH,Y}{IFCONDITION ,SSLKCONT}
  803.      Check and see if the answer is 'Y'. If it is not, skip adding the <CR>.
  804.  
  805.      {SETVARIABLE RESPONSE,%RESPONSE|}
  806.      Add the <CR> to the response.
  807.  
  808. {:SSLKCONT}
  809.  
  810.      {COMPARE RESPONSE}{IFCONDITION ,SSLKCON1}
  811.      If the user enters no data, return to the menu.
  812.  
  813.      {INFORM-D1 NO RESPONSE ENTERED - RETURNING TO LEARN MENU ...}{GOTO MENU}
  814.  
  815. {:SSLKCON1}
  816.  
  817.      {INCREMENT SSLK_CNT}
  818.      Increment the SSLOOK counter.
  819.  
  820.      {SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
  821.      {SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
  822.      Build the SSLOOK strings.
  823.  
  824.      {WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
  825.      {WRITE ^(SSLOOK SLR_%SSLK_CNT,%look_for^)}{WRITE}{WCLOSE}
  826.      Write the variable definition and the SSLOOK to the macro file.
  827.  
  828.      {SEND %RESPONSE}{SETVARIABLE CH}{SETVARIABLE RESPONSE}{CLEAR}
  829.      {GOTO CLN_QUIT}
  830.      Send the string to the system and clear variables. Begin learning again
  831.      after doing that.
  832.  
  833. {:JBL_PASS}
  834.      Process as a password.
  835.  
  836.      {COMPARE _PAS}{IFCONDITION ,PASS1}
  837.      Check and see if the password has been defined from the
  838.      dialing directory.  If it has, jump to the label shown.
  839.      Otherwise, we need to enter one.
  840.  
  841.      {CLEAR}
  842.      {DISPLAY 1,1,,ENTER YOUR PASSWORD: }
  843.      Clear the screen and prompt the user for a password.
  844.  
  845.      {GETSTRING-IP RESPONSE,,MENU}
  846.      Get keyboard input.  If the user just presses <ENTER>, then
  847.      control passes back to the menu.
  848.  
  849.      {SETVARIABLE T,^(SEND %RESPONSE|^)}
  850.      {GOTO JBL_PCNT}
  851.      Jump to this label.
  852.  
  853. {:PASS1}
  854.      Set password from dialing directory.
  855.  
  856.      {SETVARIABLE T,^(PASSWORD^) ^(SEND |^)}
  857.  
  858. {:JBL_PCNT}
  859.      Process password in macro file and send it out to the BBS.
  860.  
  861.      {WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE %T}{WRITE}{WCLOSE}
  862.      Open the macro file.  Write the command strings to the macro.
  863.      Close the macro file.
  864.  
  865.      {SETVARIABLE SSLK_CNT,0}{COMPARE _PAS}{IFCONDITION JBLPCNT2}
  866.      {PASSWORD}{SEND |}{GOTO CLN_QUIT}
  867.  
  868. {:JBLPCNT2}
  869.      {SEND %RESPONSE|}{GOTO CLN_QUIT}
  870.      Send the password out to the BBS.  Clean up after it.
  871.  
  872. {:JBL_STD}
  873.      Process standard BBS response (with <ENTER> at end).
  874.  
  875.      {SETVARIABLE RESPONSE}
  876.      Clear out the variable that is going to be used.
  877.  
  878.      {INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
  879.      Ask the user to enter a string.
  880.  
  881.      {COMPARE RESPONSE}{IFCONDITION MENU}
  882.      If the user enters no data, return to the menu.
  883.  
  884.      {setvariable response,%response|}
  885.      Add a <CR> to the response.
  886.  
  887.      {WOPEN-A %LRN_MAC}
  888.      {WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}
  889.      Open the macro file.  Write the command strings to it and
  890.      close the macro file.
  891.  
  892.      {SETVARIABLE SSLK_CNT,0}{SEND %RESPONSE}{GOTO CLEAN_UP}
  893.      Send the entered string to the BBS.  Clean up now.
  894.  
  895. {:EDITBPMT}
  896.      Edit BBS prompt.
  897.  
  898.      {KEYSTUFF 4700}
  899.      Stuff a HOME key into the keyboard buffer.  This will force
  900.      the cursor at the beginning of the line of the input window.
  901.  
  902.      {INPUT LOOK_FOR,ENTER/EDIT THE BBS PROMPT}
  903.      Allow the user to edit the BBS prompt found.
  904.  
  905.      {COMPARE LOOK_FOR}{IFCONDITION QUIT}{GOTO MENU}
  906.      If the BBS prompt is blank, leave JB-learn macro. Return to the menu.
  907.  
  908. {:OPEN_CAP}
  909.      Open capture file.
  910.  
  911.      {EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
  912.      Check and see if the capture file exists.  If it does, delete it.
  913.  
  914.      {CAPMODE FILTER}
  915.      Set the capture mode to filter.
  916.  
  917.      {CAPTURE Y,%CAPTFILE}{RETURN}
  918.      Open the capture file and return.
  919.  
  920. {:WAITTIME}
  921.      Wait timeout entry.
  922.  
  923.      {KEYSTUFF 4700}
  924.      Stuff a HOME key into the keyboard buffer.  This will force
  925.      the cursor at the beginning of the line of the input window.
  926.  
  927.      {INPUT WAITTIME,ENTER THE NUMBER OF SECONDS TO WAIT UNTIL MENU?}
  928.      {GOTO CLN_QUIT}
  929.      Ask the user for information as shown above.  Once input is done, clean up.
  930.  
  931. {:CLEAN_UP}
  932.      The clean up routine.
  933.  
  934.      {SETVARIABLE KEY}{CLEAR}
  935.      {DISPLAY 1,1,,ADD THIS RESPONSE/TARGET COMBO TO THE DATA FILE (Y/N) [N]? }
  936.      Clear the screen and ask the user if he/she would like to add this
  937.      response/target to the data file.
  938.  
  939.      {getstring-hi key,1,CLN_QUIT}
  940.      Get keyboard input
  941.  
  942.      {compare key,Y}{ifcondition ,cln_quit}
  943.      If the user answers Y the append will happen. If they do not the quit
  944.      will continue without writing to the data file.
  945.  
  946.      {WOPEN-A %DATAFILE}{WRITE %RESPONSE,%LOOK_FOR}{WCLOSE}
  947.      Write the new response/BBS prompt combination to the data file.
  948.  
  949. {:CLN_QUIT}
  950.      {CALL OPEN_CAP}{GOTO LEARNING}
  951.      Open the capture file and return to learn mode.
  952.  
  953. {:ADD_FON}
  954.      Add dialing directory entry to dialing directory for new learn macro.
  955.  
  956.      {CLEAR}
  957.      {DISPLAY 1,1,,ADD A NEW ENTRY TO YOUR DIALING DIRECTORY (Y/N) [N]? }
  958.      {GETSTRING-HI KEY,1}
  959.      Ask the user if they would like to add a new dialing directory entry.
  960.  
  961.      {COMPARE KEY,Y}{IFCONDITION ,RETURN}
  962.      Check and see if the user wishes to do this.  If not, quit the adding
  963.      routine.
  964.  
  965.      {SETVARIABLE SYS_NAME,%_NAM}
  966.      Set the variable to the system name (if known) by COMMO.
  967.  
  968.      {COMPARE SYS_NAME}{IFCONDITION ,GETNAM1}
  969.      See if the system name is known now.
  970.  
  971.      {SETVARIABLE SYS_NAME,%LRN_LBL}
  972.      Set the system name to the value defined for the label in the macro
  973.      file written during learn mode.
  974.  
  975. {:GETNAM1}
  976.      {KEYSTUFF 4700}
  977.      Stuff a HOME key into the keyboard buffer.  This will force
  978.      the cursor at the beginning of the line of the input window.
  979.  
  980.      {INPUT SYS_NAME,ENTER THE SYSTEM NAME FOR YOUR DIALING DIRECTORY ENTRY: }
  981.      Make the user verify their system name before continuing
  982.  
  983.      {COMPARE SYS_NAME}{IFCONDITION RETURN}
  984.      See if the user left the system name blank.  If he/she did then exit add.
  985.  
  986.      {SETVARIABLE FONENTRY,%SYS_NAME (WITH LEARN) %_MON/%_DAY/%_YEA ^(}
  987.      Start building the dialing directory entry string here.
  988.  
  989. {:GETNUM0}
  990.      This label denotes the beginning of processing the phone number to be
  991.      dialed.
  992.  
  993.      {SETVARIABLE T,%_NUM}
  994.      Set the variable to the value known by COMMO's internal variable.
  995.  
  996.      {KEYSTUFF 4700}
  997.      Stuff a HOME key into the keyboard buffer.  This will force
  998.      the cursor at the beginning of the line of the input window.
  999.  
  1000.      {INPUT T,ENTER THE SYSTEM'S PHONE NUMBER: }
  1001.      Ask the user to confirm the phone number.
  1002.  
  1003.      {COMPARE T}{IFCONDITION GETNUM0}
  1004.      If the phone number is blank (or edited blank), ask for the number again.
  1005.  
  1006.      {SETVARIABLE FONENTRY,%FONENTRY%%T^) ^(}
  1007.      Continue building the dialing directory entry string.
  1008.  
  1009. {:GETPAS0}
  1010.      We are now going to process the password.
  1011.  
  1012.      {COMPARE _PAS}{IFCONDITION GETPAS1}
  1013.      See if the password is defined from a linked dialing directory entry.
  1014.      If it is not, we will get a password from the user.
  1015.  
  1016.      {SETVARIABLE FONENTRY,%FONENTRY%%_PAS^) ^(}{GOTO ADD_MACRO}
  1017.      Add the password to the dialing directory entry since we know the
  1018.      password.  Jump to process the macro piece of the dialing directory
  1019.      entry.
  1020.  
  1021. {:GETPAS1}
  1022.      This label begins asking the user for a password.
  1023.  
  1024.      {CLEAR}
  1025.      {DISPLAY 1,1,,ENTER YOUR PASSWORD USED ON THIS SYSTEM: }
  1026.      Clear the screen and prompt the user for a password.
  1027.  
  1028.      {GETSTRING-IP T}{CLEAR}
  1029.      Get the password from the user.
  1030.  
  1031.      {SETVARIABLE FONENTRY,%FONENTRY%%T^) ^(}
  1032.      Add the password to the dialing directory entry.
  1033.  
  1034. {:ADD_MACRO}
  1035.      This label starts the preparation and completion of writing to the
  1036.      dialing directory.
  1037.  
  1038.      {SETVARIABLE FONENTRY,%FONENTRY%%LRN_LBL,%LRN_MAC^) ^(^)}
  1039.      Complete the dialing directory entry string here.
  1040.  
  1041.      {EXECUTE-S COPY %_HOM%%_FON %FON_FILE>NUL}
  1042.      Make a copy of your dialing directory.
  1043.  
  1044.      {IFEXIST %FON_FILE,,RETURN}
  1045.      Check and see if the copy was done correctly. If it was not, end the
  1046.      routine.
  1047.  
  1048.      {ROPEN %FON_file,FON_FIN0}{WOPEN %_HOM%%_FON}
  1049.      Open the COMMO dialing directory and the temporary file to write to here.
  1050.  
  1051.      {SETVARIABLE COUNT,0}
  1052.      Reset the counter to 0.
  1053.  
  1054. {:ADD_RWL}
  1055.      Here is where the read loop begins.
  1056.  
  1057.      {READ T}{WRITE %T}
  1058.      Read a line from the dialing directory and write it out to the
  1059.      temporary file.
  1060.  
  1061.      {COMPARE COUNT,1}{IFCONDITION-E ADD_RWL}
  1062.      Check and see if we have already written a line to the temporary for
  1063.      the new entry.  If so, just keep reading and writing.
  1064.  
  1065.      {INSTRING T,%SYS_NAME}{IFCONDITION ,ADD_RWL}
  1066.      Check and see if the line read is our system name.
  1067.      If it is not, go get another.
  1068.  
  1069.      {INCREMENT COUNT}{WRITE %FONENTRY}{GOTO ADD_RWL}
  1070.      Increment the counter.  Write the new dialing directory entry
  1071.      and go get another line.
  1072.  
  1073. {:FON_FIN0}
  1074.      This label is jumped to when the last line is read from .FON directory.
  1075.  
  1076.      {COMPARE COUNT,1}{IFCONDITION-E ADD_END}
  1077.      See if we have already written the newly created dialing directory
  1078.      entry.  If we have, skip to the label shown.
  1079.  
  1080.      {WRITE %FONENTRY}
  1081.      Write the new dialing directory entry.
  1082.  
  1083. {:ADD_END}
  1084.      {WCLOSE}{RETURN}
  1085.      Close the temporary file.
  1086.  
  1087. {:QUIT}
  1088.      Quit routine.
  1089.  
  1090.      {NOCARRIER}{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
  1091.      Reset the NOCARRIER macro function. Check and see if the capture file
  1092.      exists.  If it does, delete it.
  1093.  
  1094.      {COMPARE LRN_MAC}{IFCONDITION Q_RESET}{IFEXIST %LRN_MAC,,q_reset}
  1095.      If no macro has been started, jump to the end of the quit routine.
  1096.  
  1097.      {COMPARE LOOK_FOR}{IFCONDITION QUIT1}
  1098.      {WOPEN-A %LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE}{WCLOSE}
  1099.      Write one last LOOKFOR for the ending BBS prompt if one exists.
  1100.  
  1101. {:QUIT1}
  1102.      CLEAR SSLOOK VARIABLES OUT OF {COMMO} VARIABLE SPACE.
  1103.  
  1104.      {SETVARIABLE T}{SETVARIABLE COUNT,0}
  1105.      Clear variables and get counter ready for loop below.
  1106.  
  1107. {:SSLKLOOP}
  1108.      This is the loop that will clear those variables defined during the
  1109.      learn. Clearing commands will also be written to the macro file.
  1110.  
  1111.      {INCREMENT COUNT}
  1112.      Increment the SSLOOK counter.
  1113.  
  1114.      {SETVARIABLE-S T,SLR_%COUNT}
  1115.      Find out if a value is available for this variable.
  1116.  
  1117.      {COMPARE T}{IFCONDITION END_MACR}
  1118.      If there is not, stop processing the loop.
  1119.  
  1120.      {WOPEN-A %LRN_MAC}{WRITE ^(SETVARIABLE SLR_%COUNT^)}{WCLOSE}
  1121.      Open the macro file and write code to clear this variable out.
  1122.  
  1123.      {SETVARIABLE SLR_%COUNT}{SETVARIABLE SLT_%COUNT}{GOTO SSLKLOOP}
  1124.      Clear this variable and go get another one if it is available.
  1125.  
  1126. {:END_MACR}
  1127.  
  1128.      {WOPEN-A %LRN_MAC}
  1129.      {WRITE ^(SETVARIABLE ESCAPE_2^)}
  1130.      {WRITE ^(INFORM-D1 LOGIN COMPLETE^)}{WRITE ^(STOP^)}{WCLOSE}
  1131.      Open the macro file.  Write the ending commands to the macro file.
  1132.      Close the macro file.
  1133.  
  1134. {:Q_RESET}
  1135.  
  1136.      {CALL ADD_FON}
  1137.      Add an entry to your dialing directory for this learn macro script just
  1138.      created.
  1139.  
  1140.      Reset all variables used during learn operation.
  1141.  
  1142.      {CLEAR}{SETVARIABLE ESCAPE_2}{SETVARIABLE CAPTFILE}{SETVARIABLE WAITTIME}
  1143.      {SETVARIABLE KEY}{SETVARIABLE DATAFILE}{SETVARIABLE LOOK_FOR}
  1144.      {SETVARIABLE LRN_MAC}{SETVARIABLE POS}{SETVARIABLE T}{SETVARIABLE CMD}
  1145.      {SETVARIABLE AUTORESP}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
  1146.      {SETVARIABLE COUNT}{SETVARIABLE INVALID}{SETVARIABLE CH}
  1147.      {SETVARIABLE FONENTRY}{SETVARIABLE FON_FILE}{SETVARIABLE LRN_LBL}
  1148.      {SETVARIABLE SYS_NAME}{SETVARIABLE SSLK_CNT}{SETVARIABLE NOV_MENU}
  1149.      {SETVARIABLE SSLKAUTO}{INFORM-D1 JB-LEARN VERSION %JBL_VER IS COMPLETE}{}
  1150.      Inform the user that processing is complete and stop macro execution.
  1151.  
  1152. {:RETURN}{RETURN}
  1153.